package cn.iocoder.yudao.module.security.job;

import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.infra.util.TraceIdUtil;
import cn.iocoder.yudao.module.security.service.asset.SecurityAssetAggService;
import cn.iocoder.yudao.module.security.service.device.SecurityDeviceService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 资产汇总 Job
 *
 * @author 芋道源码
 */
@Component
public class AssetAggJob implements JobHandler {

    @Resource
    private SecurityAssetAggService securityAssetAggService;

    @Override
    @TenantJob
    public String execute(String param) {
        try {
            TraceIdUtil.setTraceId(null);
            int count = securityAssetAggService.aggAsset();
            return String.format("汇总资产 %s 个", count);
        } finally {
            TraceIdUtil.removeTraceId();
        }
    }

}
